{% extends "main/index.html" %}

{% load i18n %}
{% block title %}
<title>{% trans "Users" %}</title>
{% endblock %}
{% block content %}
    <div class="titulo_contenedor">
        <span>{% trans "Sirogi users" %}</span>
    </div>
    <div class="cuerpo_contenedor">
        <p>{% trans "Use this form to search for members. You can search by username or by last name." %}</p>
        <form action="/users/" method="post">
            <label for="search_login">{% trans "Username" %}</label>
            <input type="text" name="search_login" id="search_login"/>
            <br/>
            <label for="search_last_name">{% trans "Last name" %}</label>
            <input type="text" name="search_last_name" id="search_last_name"/>
            <input type="submit" value="{% trans 'Search' %}" class="boton_1"/>
        </form>
        <br/>
        <br/>
        <hr/>
        <br/>
        {% if results %}
        <table>
            <tr>
                <th>{% trans "First name" %}</th>
                <th>{% trans "Last name" %}</th>
                <th>{% trans "Username" %}</th>
                <th>{% trans "Role" %}</th>
            </tr>
            {% for user in results%}
            <tr>
                <td><a href="/users/{{user.username}}">{{ user.first_name }}</a></td>
                <td><a href="/users/{{user.username}}">{{ user.last_name }}</a></td>
                <td><a href="/users/{{user.username}}">{{ user.username }}</a></td>
                <td><a href="/users/{{user.username}}">{{ user.get_role_display }}</a></td>
            </tr>
            {% endfor %}
        </table>
        <br/>
        {% endif %}
        {% if is_manager %}
            <a href="/add_new_user">{% trans "Add a new user"%}</a>
        {% endif %}
    </div>
    <div class="fondo_contenedor">
    </div>
{% endblock %}    
